<?php
/**
 * Created by PhpStorm
 * User: shen.zk
 * Date: 2023/8/26
 * Time: 18:07
 * Comment: ''
 */

namespace App\Http\Controllers\Common;

use App\Http\Controllers\BaseController;
use App\Params\Common\LoginParams;
use App\Service\Common\MemberService;
use App\Params\Common\AuthenticationMemberParams;
use App\Params\Common\MemberParams;
use App\Params\Common\GoodsUgcBindParams;
use App\Params\Common\MemberEarliestOrderTimeParams;

class MemberController extends BaseController
{
    /**
     * 用户登入
     * @return \Illuminate\Http\JsonResponse
     * @throws \App\Exceptions\BusinessException
     * @author shen.zk
     * @date 2023-08-27 11:44
     */
    public function login()
    {
        $params = LoginParams::create();
        $data = MemberService::getInstance()->LoginService($params);
        return $this->success($data);
    }

    /**
     * 用户登入+实名
     * @return \Illuminate\Http\JsonResponse
     * @throws \App\Exceptions\BusinessException
     * @author shen.zk
     * @date 2023-09-04 16:50
     */
    public function registerAuthMember()
    {
        MemberService::getInstance()->registerAuthMemberService();
        return $this->success();
    }

    /**
     * 用户注册
     * @return \Illuminate\Http\JsonResponse
     * @throws \App\Exceptions\BusinessException
     * @author shen.zk
     * @date 2023-08-27 12:16
     */
    public function registerMember()
    {
        MemberService::getInstance()->registerMemberService();
        return $this->success();
    }

    /**
     * 实名认证
     * @return \Illuminate\Http\JsonResponse
     * @throws \App\Exceptions\BusinessException
     * @author shen.zk
     * @date 2023-09-04 15:43
     */
    public function authenticationMember()
    {
        $params = AuthenticationMemberParams::create();
        MemberService::getInstance()->authenticationMemberService($params);
        return $this->success();
    }

    /**
     * 获取用户信息
     * @return \Illuminate\Http\JsonResponse
     * @throws \App\Exceptions\BusinessException
     * @author shen.zk
     * @date 2023-09-07 10:21
     */
    public function getUserInfo()
    {
        $info = MemberService::getInstance()->getUserInfoService();
        return $this->success($info);
    }

    /**
     * 用户的藏品列表
     * @return \Illuminate\Http\JsonResponse
     * @throws \App\Exceptions\BusinessException
     * @throws \RedisException
     * Author:xsc
     * Time:2023/10/8 16:33
     */
    public function specialList()
    {
        $params = MemberParams::create();
        $data = MemberService::getInstance()->specialList($params);
        return $this->success($data);
    }

    /**
     * 用户的商品列表
     * @return \Illuminate\Http\JsonResponse
     * @throws \App\Exceptions\BusinessException
     * @throws \RedisException
     * Author:xsc
     * Time:2023/9/19 18:18
     */
    public function goodsList()
    {
        $params = MemberParams::create();
        $data = MemberService::getInstance()->goodsList($params);
        return $this->success($data);
    }

    /**
     * 用户ugc赋能订单
     * @return \Illuminate\Http\JsonResponse
     * @throws \App\Exceptions\BusinessException
     * Author:xsc
     * Time:2023/10/10 17:21
     */
    public function ugcOrderList()
    {
        $params = GoodsUgcBindParams::create();
        $data = MemberService::getInstance()->ugcOrderList($params);
        return $this->success($data);
    }

    /**
     * 查询用户最早下单时间(批量)
     * @return \Illuminate\Http\JsonResponse
     * @throws \App\Exceptions\BusinessException
     * Author:xsc
     * Time:2023/11/10 15:06
     */
    public function earliestOrderTime()
    {
        $params = MemberEarliestOrderTimeParams::create();
        $data = MemberService::getInstance()->earliestOrderTime($params);
        return $this->success($data);
    }

}
